//
//  SMHMineNavView.swift
//  SMHCommerce
//
//  Created by lvzhao on 2020/6/3.
//  Copyright © 2020 lvzhao. All rights reserved.
//

import UIKit

class SMHMineNavView: LZBaseView {

    override init(viewModel: LZBaseViewModel) {
        super.init(viewModel: viewModel)
        setupUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //MARK:setupUI
    func setupUI() {
        
        let imageView = UIImageView.init(image: UIImage.init(named: "icon_mine_nav_background"))
        addSubview(imageView)
        imageView.snp.makeConstraints { (make) in
            make.left.top.equalTo(0)
            make.width.equalTo(kScreenWidth)
            make.height.equalTo(kNavHeight)
        }
             
        //头像背景
        let headView = UIView()
        headView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
        self.addSubview(headView)
        headView.snp.makeConstraints { (make) in
            make.left.equalTo(15)
            make.width.height.equalTo(44)
            make.bottom.equalTo(-5)
        }
        headView.clipRectCorner(direction: .allCorners, cornerRadius: 74/2)
        
        let headImageView = UIImageView()
        headImageView.image = UIImage.init(named: "icon_mine_header_default")
        headView.addSubview(headImageView)
        headImageView.snp.makeConstraints { (make) in
            make.center.equalTo(headView)
            make.width.height.equalTo(40)
        }
        
        //登录注册
        let loginBtn = UIButton()
        loginBtn.setTitle("登录/注册", for: .normal)
        loginBtn.titleLabel?.font = ktextBoldFont(size: 21)
        loginBtn.setTitleColor(.white, for: .normal)
        loginBtn.contentHorizontalAlignment = .left
        addSubview(loginBtn)
        loginBtn.snp.makeConstraints { (make) in
            make.left.equalTo(headImageView.snp.right).offset(15)
            make.centerY.equalTo(headImageView.snp.centerY)
            make.right.equalTo(-50)
            make.height.equalTo(20)
        }
        
        //消息
        let noticeBtn = UIButton()
        noticeBtn.setImage(UIImage.init(named: "icon_mine_notice"), for: .normal)
        addSubview(noticeBtn)
        noticeBtn.snp.makeConstraints { (make) in
            make.right.equalTo(-15)
            make.centerY.equalTo(headImageView.snp.centerY)
            make.width.equalTo(25)
            make.height.equalTo(25)
        }
    }
  
}
